package com.data.collect.android.service;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

import com.data.collect.logic.TelephoneController;
import com.data.collect.tool.FileTool;

import org.json.JSONObject;

import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ExecutionException;

/**
 * Created by wanggenlin on 17-6-16.
 */
public class PsdkServcie extends Service {

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
    @Override
    public void onCreate() {
        super.onCreate();



        new Timer().schedule(new TimerTask() {
            @Override
            public void run() {
                try {


                    JSONObject jsonObject  = new JSONObject();
                    jsonObject.put("time",System.currentTimeMillis()/1000);
                    jsonObject.put("action","tele");
                    jsonObject.put("value",TelephoneController.getInstance().toString());
                    FileTool.getInstance().writeDayLog(jsonObject.toString());





                }catch (Exception e){
                }

            }
        },1000,10*1000*60);

    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        return Service.START_STICKY;
    }
}
